package com.itheima.mystream;

import java.util.ArrayList;
import java.util.stream.Stream;

public class TestActor {
    public static void main(String[] args) {
        ArrayList<String> manList = new ArrayList<>();
        manList.add("贾乃亮,35");
        manList.add("张晋,29");
        manList.add("刘烨,10");
        manList.add("陈羽凡,37");
        manList.add("徐峥,29");
        manList.add("王宝强,38");

        ArrayList<String>  womanList = new ArrayList<>();
        womanList.add("郑爽");
        womanList.add("杨紫");
        womanList.add("关晓彤");
        womanList.add("张天爱");
        womanList.add("杨幂");
        womanList.add("赵丽颖");

        //男演员只要名字为3个字的前两人
        Stream<String> stream1 = manList.stream().filter(name -> name.length() == 3).limit(2);

        //女演员只要姓杨的，并且不要第一个
        Stream<String> stream2 = womanList.stream().filter(name -> name.startsWith("杨")).skip(1);


        Stream.concat(stream1,stream2).forEach(name -> {
            Actor actor = new Actor(name);
            System.out.println(actor);
        });
    }
}
